package com.xiaomi.front.service.mycollection;

import com.xiaomi.front.dao.Mycollection.MycollectionDao;
import com.xiaomi.pojo.Mycollection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MycollectionServiceImpl implements MycollectionService {

    @Autowired
    private MycollectionDao mycollectionDao;

    //是否收藏
    @Override
    public Boolean ifCollection(int id, int commid) {
        Mycollection mycollection = mycollectionDao.getCollection(id, commid);
        return mycollection != null;
    }

    //添加收藏
    @Override
    public int addCollecion(int userid, int commid) {
        return mycollectionDao.addCollecion(userid, commid);
    }

    //删除删除
    @Override
    public int deleteCollection(int userid, int commid) {
        return mycollectionDao.deleteCollection(userid, commid);
    }

    //查看收藏商品数量
    @Override
    public int GetCount(int uid) {
        return mycollectionDao.GetCount(uid);
    }

    //根据uid查看 用户所有收藏商品
    @Override
    public List<Mycollection> GetAllColl(int id) {
        return mycollectionDao.GetAllColl(id);
    }

}
